<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" %>
<header class="am-topbar am-topbar-inverse" style="padding: 0;margin: 0;">
    <div class="main">
        <h1 class="am-topbar-brand">
            <a href="#">${applicationScope.ojName}</a>
        </h1>

        <div class="am-collapse am-topbar-collapse" id="doc-topbar-collapse">
            <ul class="am-nav am-nav-pills am-topbar-nav">
                <li>
                    <a href="${pageContext.request.contextPath}/contest.html">返回首页</a>
                </li>
                <li class="problemset">
                    <a href="${pageContext.request.contextPath}/contest/problemset.html?cid=${param.cid}">比赛题目</a>
                </li>
                <li class="status">
                    <a href="${pageContext.request.contextPath}/contest/status.html?cid=${param.cid}">比赛状态</a>
                </li>
                <li class="ranklist">
                    <a href="${pageContext.request.contextPath}/contest/ranklist.html?cid=${param.cid}">比赛排名</a>
                </li>
            </ul>

            <div class="am-topbar-right">
                <c:choose>
                    <c:when test="${sessionScope.user eq null}">
                        <a href="#"
                           id="login"
                           class="am-btn am-btn-primary am-topbar-btn am-btn-sm">登录 / 注册 </a>
                    </c:when>
                    <c:otherwise>
                        <a href="${pageContext.request.contextPath}/userinfo.html"
                           class="am-btn am-btn-primary am-topbar-btn am-btn-sm">${sessionScope.user.nick}</a>
                    </c:otherwise>
                </c:choose>
            </div>
        </div>
    </div>
</header>
<script src="${pageContext.request.contextPath}/js/jquery.min.js"></script>
<script>
    $(function () {
        $('#login').click(function () {
            var url = window.location.href;
            window.location.href = "${pageContext.request.contextPath}/login.html?from=" + url;
        });
    })
</script>